fix(simulator): replay measured NitroTPM boot PCRs - #1020
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the TEE simulator reproduce the measured AWS NitroTPM boot PCR state (PCR4/7/12) by generating a replay artifact at image-assembly time, carrying it through the VMM simulator configuration path, and replaying the events into swtpm before producing simulated NSM evidence.
Changes:
- Generate and package
measurement.aws.replay.jsonfromnitro-tpm-pcr-computedebug trace duringos/imageassembly, and include it in checksums and image archives. - Add typed representation of the replay document (
AwsPcrReplay) and transport it through VMM intoTeeSimulatorConfig. - Replay the recorded SHA-384 PCR extensions into the simulator TPM backend and validate the resulting PCR values match the expected final PCRs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| os/image/README.md | Documents the new AWS replay artifact and its role in simulator PCR reproduction. |
| os/image/aws-pcr-replay.py | New script to convert AWS tool trace into a replay document and verify final PCRs. |
| os/image/assemble.sh | Captures AWS tool trace, generates measurement.aws.replay.json, and packages it into image artifacts/checksums. |
| dstack/vmm/src/app/qemu.rs | Updates test struct initialization to include the new AWS replay field. |
| dstack/vmm/src/app/image.rs | Loads optional measurement.aws.replay.json alongside AWS measurement material. |
| dstack/vmm/src/app.rs | Plumbs replay config through vm_config/simulator config, and cross-checks replay PCRs match measurement.aws.cbor. |
| dstack/tee-simulator/src/tpm.rs | Replays AWS boot PCR events into swtpm and verifies PCR4/7/12 against expected values. |
| dstack/dstack-types/src/lib.rs | Adds AwsPcrReplay types and includes them in TeeSimulatorConfig. |
Suppressed comments (1)
dstack/tee-simulator/src/tpm.rs:413
- This
anyhow::ensure!message uses{index}without providing anindexformatting argument, which will not compile. Passindexas a formatting argument (or switch to positional formatting).
actual == *expected,
"replayed PCR{index} mismatch: expected={}, actual={}",
hex::encode(expected),
hex::encode(actual)
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kvinwang
force-pushed
the
fix/simulator-nitrotpm-measurement-master
branch
from
August 6, 2026 02:41
b8bccd9 to
f59fcc0
Compare
kvinwang
added a commit
that referenced
this pull request
Aug 6, 2026
…tlog [STACKED on #1020] fix(simulator): replay image-specific GCP TPM events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Context
This supersedes #960, which was accidentally merged into its stacked base branch instead of
master. This replacement is based directly on the latestmaster.Verification
cargo fmt --manifest-path dstack/Cargo.toml --all --checkcargo check --manifest-path dstack/Cargo.toml -p dstack-types -p dstack-vmm -p dstack-tee-simulatorpython3 -m py_compile os/image/aws-pcr-replay.pybash -n os/image/assemble.shgit diff --check origin/master...HEAD